/**
 * author: MaHX
 * date: 2019/8/19/0:13
 * description:
 **/
public class MyQueue {
    int size = 0;
    Node head = null;
    Node foot = null;
    public void queuePush(Object value){
        Node newNode = new Node(value);
        if (foot == null){
            foot = newNode;
        }
        newNode.setNext(head);
        head = newNode;
        size++;
    }
    public void queuePop(){
        Node temp = head;
        //寻找foot的前一个节点
        while (temp.getNext()!=foot){
            temp = temp.getNext();
        }
        foot = temp;
        size--;
    }
    public int size(){
        return size;
    }
    public Object get(int index){
        Node temp = head;
        for (int i = 0; i < index; i++) {
            temp = temp.getNext();
        }
        return temp.getValue();
    }
}
